<%@ page language="java"  pageEncoding="UTF-8" %>
<%@ page import="com.shopping.modean.*" %>
<%@ page import="com.shopping.service.*" %>
<%@ page import="java.util.*" %>

<%	

	User u = (User)session.getAttribute("user");
	if(u == null) {
		response.sendRedirect("login.jsp");
		return;
	}
	
	Cart cart = (Cart)session.getAttribute("cart");
	if(cart == null) {
		cart = new Cart();
		session.setAttribute("cart", cart);
	}
	
	request.setCharacterEncoding("UTF-8");
	int id = Integer.parseInt(request.getParameter("id"));
	Product p = ProductService.getInstance().detail(id);
	CartItem ci = new CartItem();
	ci.setProductId(id);
	ci.setPrice(p.getMemberPrice());
	ci.setCount(1);
	cart.add(ci);
	
	response.sendRedirect("cart.jsp");
%>

<!DOCTYPE html>
<html>
<head>
  <title>产品详情</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <script type="text/javascript" src="script/regcheckdata.js"></script>
</head>

<body>
	
</body>
</html>